package com.easy.system.database;

import com.easy.yours.biz.model.Clazz;
import com.easy.yours.biz.model.Student;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * Created with IntelliJ IDEA.
 * User: sunguangzhu
 * Date: 13-7-30
 * Time: 下午9:06
 * To change this template use File | Settings | File Templates.
 */
public class HibernateUtils {
    public static void ExportDB() {
       /* Configuration cfg = new Configuration().configure();
        SchemaExport export = new SchemaExport(cfg);
        export.create(true, true);*/
      /*  Configuration configuration = new AnnotationConfiguration();
        configuration.configure();
        SchemaExport export = new SchemaExport(configuration);
        export.execute(true, true, false, true);*/
        Configuration configuration = new AnnotationConfiguration().configure().addPackage("com.easy.yours.biz.model")
                .addAnnotatedClass(Student.class).addAnnotatedClass(Clazz.class);
        SchemaExport export = new SchemaExport(configuration);
        export.execute(true, true, false, true);
    }

    public static void main(String[] args) {
        HibernateUtils.ExportDB();
    }
}
